import React, { Component } from 'react';
import common from '../../utils/common'
import Style from './index.scss'

class Process extends Component {
    constructor(props) {
        super(props);

    }

    /**
     * 获取指定的时间
     * @param type 类型:day(2017-02-28) h(11:35)
     */
    getTimes(type = 'day') {
        let time = this.props.handleDate;
        let pos = time.indexOf(' '); //空格的位置
         return type === 'day' ? time.substr(0, pos) : time.substr(pos + 1, 5)
    }

    componentWillMount() {
        console.log()
    }

    componentDidMount() {

    }

    componentWillUnmount() {

    }

    render() {
        let isLine= this.props.isLine,
            index = this.props.index;
	    let fmt = 'yyyy-MM-dd hh:mm:ss';
	    let createTime=common.format(this.props.createTime,fmt);
      let lineColor = index>0?Style.gray:''
        return (
          // ' hor'
            <div className={Style.process }>
                <div className={Style.processLine}>
                    <div className={Style.line+' '+lineColor} style={isLine?{border:'none'}:{}}>
                      {
	                      index == 0? <img src="./images/icon_success.png" alt="" className={Style.state_success_icon}/>:
                                    <i className={Style.state_icon}></i>
                      }

                    <div className={Style.text}>
                        <div className={Style.title} style={index == 0?{color: '#00B488'}:{}}>{this.props.name}</div>
                        <div className={Style.time_D} style={index == 0?{color: '#00B488'}:{}}>{createTime}</div>
                        <div style={{height: '.3rem'}}></div>
                    </div>
                    </div>
                </div>
            </div>
        );
    }
}

Process.defaultProps = {
    isCurrent: false, //处于当前进度
    time: '2017-02-28 11:59:49',
    title: <span>这里是标题的</span>, //标题
    msg: <p>这里是详细描述的信息这里是详细描述的信息这里是详细描述的信息<a>138000000008</a></p>, //详细描述
   // fail: true, //失败
}

export default Process;